﻿<%@ Page Language="C#" MasterPageFile="~/BasicBase/BasicBase.master" AutoEventWireup="true" CodeFile="SocLinkeEdit.aspx.cs"  StylesheetTheme="Content"  Inherits="BasicBase_SocLinke_SocLinkeEdit" Title="社会联动信息修改" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<link rel="stylesheet" type="text/css" href="easyUI/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="easyUI/themes/icon.css">
	<script type="text/javascript" src="easyUI/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="easyUI/jquery.easyui.min.js"></script>
	<script language="javascript">
		$(function(){
			$('#sort01').combobox({
				url:'SocLinke.ashx?act=BigSort&m'+Math.random(),
				valueField:'id',
				width:'200',
				textField:'text'
			});
			$('#sort01').combobox({onChange:function(newValue){
				
				if(newValue=='A400')
				{
					$('#InfoNameTxt').html("专家姓名：");
					$('#AddressTxt').html("工作单位：");
				}else
				{
					$('#InfoNameTxt').html("单位名称：");
					$('#AddressTxt').html("单位地址：");
				}
			}});
			var sortid='<%=sortid %>';
			$('#sort01').combobox("select",sortid.substring(0,2)+'00');
		});
		var SxTr=0;
		function PropInit(vi,propname,propunit)
		{
		    //$('#n'+vi).numberbox({precision:'2'});
			SxTr=parseInt(vi)+1;
			   $('#sSocProp'+vi).combobox({
				url:'SocLinke.ashx?act=PropName&m'+Math.random(),
				valueField:'id',
				textField:'text'
				});
			     $('#dSocProp'+vi).combobox({
				url:'SocLinke.ashx?act=PropUnit&m'+Math.random(),
				valueField:'id',
				textField:'text'
				});
				$('#sSocProp'+vi).combobox("select",propname);
				$('#dSocProp'+vi).combobox("select",propunit);
		}
		
		
	function AddSx(currentRowID)
	{
		$.each( $('#mainTable tr'), function(i, tr){
           if($(this).attr('id')==currentRowID){
               //获取当前行
               var currentRow=$('#mainTable tr:eq('+i+')');
               //要添加的行的id
			   SxTr=parseInt(SxTr);
               var addRowID="SocProp"+SxTr;
               //str = "<tr id = '"+addRowID+"'><td>"+addRowID+"</td><td>row"+addRowID+"</td>"+
               //"<td><input id= '"+addRowID+"' type='button' value='添加行' onclick='addRowByID(this.id);' /></td></tr>";
               //当前行之后插入一行
			   str=" <tr id = '"+addRowID+"'>"+
					"<td height=\"25\" align=\"right\" valign=\"middle\">属性名称：</td>"+
					"<td height=\"25\" align=\"left\" valign=\"middle\"><label>"+
					  "<input type=\"text\" id=\"s"+addRowID+"\" name=\"s"+addRowID+"\"  required=\"true\"/>"+
					"数量："+
					"<input name=\"n"+addRowID+"\" class=\"easyui-numberbox\" id=\"n"+addRowID+"\" type=\"text\" style='width:80px;' precision=\"2\" required=\"true\"/>"+
					"单位："+
					
					"<select name=\"d"+addRowID+"\"  id=\"d"+addRowID+"\" style=\"width:60px;\" required=\"true\">"+
					"</select><input type=\"button\" onclick=\"delSx('"+addRowID+"')\" name=\"Button2\" value=\"删除\" id=\"Button2\" class=\"button_default\" />"+
				   " </label></td>"+
				  "</tr>";
				
               currentRow.after(str);
			   $('#n'+addRowID).numberbox({precision:'2'});
			   $('#s'+addRowID).combobox({
				url:'SocLinke.ashx?act=PropName&m'+Math.random(),
				valueField:'id',
				textField:'text'
				});
			     $('#d'+addRowID).combobox({
				url:'SocLinke.ashx?act=PropUnit&m'+Math.random(),
				valueField:'id',
				textField:'text'
				});
           }
       });
	}
		function delSx(vi)
		{
			$("#"+vi).remove();
		}
	</script>
<table width="100%" border="0" id="mainTable" cellspacing="0" cellpadding="0">
	<caption>
            <span>社会联动信息添加</span>
    </caption>

  <tr>
    <td width="100" height="25" align="right" valign="middle">信息类别：</td>
    <td align="left" valign="middle"><select id="sort01"  name="sort01" style="width:200px;" >
	
	</select></td>
  </tr>
  <tr>
    <td width="100" height="25" align="right" valign="middle" id="InfoNameTxt">单位名称：</td>
    <td align="left" valign="middle"><input name="infoid" type="hidden" value="<%=infoid2 %>" /><input name="InfoName" class="easyui-validatebox" type="text" style="width:395px;" value="<%=infoname %>" required="true" /></td>
  </tr>
  <tr>
    <td height="25" align="right" valign="middle">联系人：</td>
    <td align="left" valign="middle"><input name="LinkPeople" class="easyui-validatebox" type="text" style="width:395px;" value="<%=LinkPeople %>" required="true" /></td>
  </tr>
  <tr>
    <td width="100" height="25" align="right" valign="middle">联系电话：</td>
    <td align="left" valign="middle"><input name="TelPhone" class="easyui-validatebox" type="text" style="width:395px;" value="<%=TelPhone %>" required="true" /></td>
  </tr>
  <tr>
    <td width="100" height="25" align="right" valign="middle">单位传真：</td>
    <td align="left" valign="middle"><input name="Fax" type="text" style="width:395px;" value="<%=Fax %>" /></td>
  </tr>
  <tr>
    <td width="100" height="25" align="right" valign="middle" id="AddressTxt">单位地址：</td>
    <td align="left" valign="middle"><input name="Address" type="text" style="width:395px;" value="<%=Address %>" /></td>
  </tr>
  <tr id="SxAfter">
    <td width="100" height="25" align="right" valign="middle">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</td>
    <td align="left" valign="middle"><input name="mark" type="text" style="width:395px;" value="<%=mark %>"  />
    <%if (!View)
      {%>
    <input type="button" onclick="AddSx('SxAfter')" name="Button1" value="添加属性" id="Button1" class="button_default" />
    <%} %>    </td>
  </tr>
  <%for (int i = 0; i < PropData.Rows.Count; i++)
    { %>
  <tr id="SxAfter<%=i.ToString() %>">
    <td height="25" align="right" valign="middle">属性名称：</td>
    <td align="left" valign="middle"><input name="SocPropID<%=i.ToString() %>" type="hidden" value="<%=PropData.Rows[i]["SocPropID"].ToString().Trim() %>" /><select id="sSocProp<%=i.ToString() %>"  name="sSocProp<%=i.ToString() %>" style="width:200px;" >
	</select>数量：<input name="nSocProp<%=i.ToString() %>" class="easyui-numberbox" id="nSocProp<%=i.ToString() %>" type="text" style='width:80px;' precision="2" value="<%=PropData.Rows[i]["SocPropCount"].ToString().Trim() %>" required="true"/>单位：<select name="dSocProp<%=i.ToString() %>"  id="dSocProp<%=i.ToString() %>" style="width:60px;" required="true" />
	<%if (!View)
   {%>
	<input type="button" onclick="delSx('SxAfter<%=i.ToString() %>')" name="Button2" value="删除" id="Button2" class="button_default" />
	<%} %>	</td>
  </tr>
  <script language="javascript">
  PropInit('<%=i.ToString() %>','<%=PropData.Rows[i]["SocPropName"].ToString().Trim() %>','<%=PropData.Rows[i]["SocPropUnit"].ToString().Trim() %>');
  </script>
  <%} %>
  <tr>
    <td width="100" height="25" align="right" valign="middle"></td>
    <td align="left" valign="middle">
    <%if (!View)
      {%>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="保存" /> 
        <%} %>     </td>
  </tr>
</table>
</asp:Content>

